var id;
var value;

function add(i, v){
	id=i;
	value=v;
}


function check(){
        var xmlHttp = false;
        xmlHttp = createXMLHttpRequest();
        var url = "reposicion_de_fabrica.jsp?estado=update&id="+encodeURIComponent(id)+"&value="+encodeURIComponent(value);
        //xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
        xmlHttp.onreadystatechange=function(){handleStateChange(xmlHttp);}
        xmlHttp.open("GET", url ,true);
        xmlHttp.send(null);
}
 
function createXMLHttpRequest() {
        var xmlHttp = false;
       
        if(window.ActiveXObject) {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        else if(window.XMLHttpRequest) {
                xmlHttp = new XMLHttpRequest();
        }
        return xmlHttp;
}
 
 
function handleStateChange(xmlHttp){
        if(xmlHttp.readyState == 4){
                if(xmlHttp.status == 200){
                	var id = xmlHttp.responseXML.getElementsByTagName("id")[0];
                	var value = id.getElementsByTagName("value")[0];
                	
                	var elemento = document.getElementById(id.childNodes[0].nodeValue);
                	elemento.value = value.childNodes[0].nodeValue;
                	
                	var idP = id.getElementsByTagName("idP")[0];
                	var msj = id.getElementsByTagName("msj")[0];
                	var elemento2 = document.getElementById(idP.childNodes[0].nodeValue);
                	elemento2.innerHTML = msj.childNodes[0].nodeValue;
                	//alert(idP.childNodes[0].nodeValue);
                	//alert(msj.childNodes[0].nodeValue);
                	
                }
        }
}
 

